<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="codec" uri="/WEB-INF/tld/codec.tld"%>
<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript" src="${ctx}/resources/js/datatable-query.js"></script>

<div class="row-fluid">
	<div class="span12">
		<div class="box gradient">
			<div class="title">
				<h4>
					<span>News Letter Email Manager </span> <span class="box-form right">
					</span>
				</h4>


				<a href="#" class="minimize"></a>
			</div>

			<div class="content scrollable clearfix">
				<table class="ajaxTable display table table-bordered">
					<thead>
						<tr>
							<th><a class="select_all"><span class="icomoon-icon-checkmark-2"></span></a></th>
<th>Name </th>
<th>Email </th>
<th>CustomerId </th>
<th>Type </th>
<th>SurName </th>
<th>GivenName </th>
 
 							<th>Operation</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>
 	<script type="text/javascript">
		var render = false;

		$(document).ready(function() {
			johnny.oTable = $('.ajaxTable').dataTable({
				"aoColumnDefs" : [ {
					'bSortable' : false,
					'aTargets' : [ 0 ]
				} ],
				"bLengthChange" : true,
				"sAjaxSource" : '${ctx}/admin/news-letter-email/',
				"fnInitComplete" : function(oSettings, json) {
				}
			});
			var name = $("<input>").attr({
				type : "text",
				field : "name",
				op : "cn",
				placeholder : "Name",
				class : "filterdata"
			});
			johnny.initTableQuery(name);
			
			var del = {
			id : 'newsLetterEmailDel',
			text  : 'Del',
			domain : "News Letter Email",
			operation : "Del",
			url : "${ctx}/admin/news-letter-email/del/" 			};
			johnny.tableBtn(del);
 		});

		var columnHeader = [ '', 'name','email','customerId','type','surName','givenName'  ];
		var QueryData = function(aoData) {
			return johnny.initQueryData(aoData, columnHeader);
		}

		var DataTableForm = function(json, echo) {
			var dataArray = new Array();
			for ( var i = 0; i < json.result.length; i++) {
				var link = "${ctx}/admin/news-letter-email/"+json.result[i].id+"/edit/";
				var subArray = new Array();
				var value = johnny.getForSelect(json.result[i].id);
				subArray.push(value);
				subArray.push(json.result[i].name)
subArray.push(json.result[i].email)
subArray.push(json.result[i].customerId)
subArray.push(json.result[i].type)
subArray.push(json.result[i].surName)
subArray.push(json.result[i].givenName)
 subArray.push(johnny.getEditHtml(link));
 				dataArray.push(subArray);
			}
			return {
				sEcho : echo,
				iTotalRecords : json.totalCount,
				iTotalDisplayRecords : json.totalCount,
				aaData : dataArray
			};
		}

	 
	</script>
 	<a href="${ctx}/admin/news-letter-email/create/" class="btn btn-info"> <span
		class="icon12 icomoon-icon-plus white"></span> New</a>
</div>
